﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using AppUIView;
using Communication;
using Global;
using IPlugin.Events;
using IPlugins;
using IPlugins.Events;

namespace DebuggerApp
{
    // 标记为可注入类
    [Injectable(LifeTime.Singleton)]
    public partial class DebuggerMainForm : Form
    {
        public IOperation OperationView;
        private readonly IPluginHost _pluginHost;
        private readonly ILogger _logger;
        private readonly IEmailService _emailService;

        public DebuggerMainForm(IPluginHost pluginHost,ILogger logger)
        {            
            InitializeComponent();
            _pluginHost = pluginHost;
            _pluginHost.MainForm = this;
            _logger = logger;
            //_emailService = emailService;
            _logger.Log("依赖服务已加载");
            //_emailService.SendEmail("","","");
        }

        private void DebuggerMainForm_Shown(object sender, EventArgs e)
        {
            _pluginHost.InitializePluginSystem();
            var dd = new OptionInfo(OperationView);
            dd.MdiParent = this;            
            dd.Show();
        }

        protected override void OnFormClosing(FormClosingEventArgs e)
        {
            base.OnFormClosing(e);
        }

        private void logToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var dd = new Log();
            dd.MdiParent = this;
            dd.Show();
        }

    }


}
